
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;



public class e007 {
    public static void main(String[] args) {
		long sTime = System.currentTimeMillis();
        Set<Long> a = Sieve(120000);
        ArrayList<Long> b = new ArrayList<Long>(a);
        Collections.sort(b);
        System.out.println(b.get(10000));
		long fTime = System.currentTimeMillis();
        System.out.println("Time: " + (fTime - sTime) + "ms");
    }

    public static Set<Long> Sieve(int limit) {
        HashSet<Long> allNums = new HashSet<Long>();
        for(long i = 2; i <= limit; i++) {
            allNums.add(i);
        }
        long p = 2;
        int numIndex = 1;
        boolean stop = false;
        while (!stop) {
            int size = allNums.size();
            for (long i = 2; i <= limit / p; i++) {
                long n = i * p;
                allNums.remove(n);
            }
            if (size == allNums.size() && allNums.contains(p)){
                stop = true;
            }
            p ++;
            numIndex++;
        }
        return allNums;
    }
}